home *** CD-ROM | disk | FTP | other *** search
- /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Copyright (C) 1994, by WATCOM International Inc. All rights %
- % reserved. No part of this software may be reproduced or %
- % used in any form or by any means - graphic, electronic or %
- % mechanical, including photocopying, recording, taping or %
- % information storage and retrieval systems - except with the %
- % written permission of WATCOM International Inc. %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- */
-
- #ifndef _WICON_HPP_INCLUDED
- #define _WICON_HPP_INCLUDED
-
- #ifndef _WNO_PRAGMA_PUSH
- #pragma pack(push,8);
- #pragma enum int;
- #endif
-
- #ifndef _WOBJECT_HPP_INCLUDED
- # include "wobject.hpp"
- #endif
- #ifndef _WARRAY_HPP_INCLUDED
- # include "warray.hpp"
- #endif
- #ifndef _WRESID_HPP_INCLUDED
- # include "wresid.hpp"
- #endif
- #ifndef _WPOINT_HPP_INCLUDED
- # include "wpoint.hpp"
- #endif
- #ifndef _WSIZE_HPP_INCLUDED
- # include "wsize.hpp"
- #endif
-
- class WImageList;
-
- enum WStockIcon {
- WSIconFirst,
- WSIconApplication = WSIconFirst,
- WSIconAsterisk,
- WSIconExclamation,
- WSIconStopSign,
- WSIconQuestion,
- WSIconLast = WSIconQuestion
- };
-
- class WBitmap;
- class WColor;
- class WCanvas;
- class WIconReference;
- class WFilePath;
- class WIcon;
-
- extern template WArrayReference<WIcon>;
- extern template WArray<WIcon>;
- typedef WArray<WIcon> WIconArray;
-
- class WCMCLASS WIcon : public WObject {
- WDeclareSubclass( WIcon, WObject );
-
- friend class WImageList;
-
- public:
-
- /************************************************************
- * Constructors and Destructors
- ************************************************************/
-
- WIcon();
- WIcon( WStockIcon stock );
- WIcon( const WResourceID & id, WModuleHandle module=_ApplicationModule );
- WIcon( const WChar * file, const WResourceID & id);
- WIcon( const WChar * file, WBool monochrome,
- const WSize & iconSize = WSize(0,0) );
- WIcon( WIconHandle handle, WBool deleteHandle=FALSE );
- WIcon( const WIcon & icon );
- WIcon( const WBitmap & bitmap, WPoint hotPoint, WBool color=TRUE,
- WBool useSystemIconSize=TRUE );
-
- ~WIcon();
-
- /************************************************************
- * Properties
- ************************************************************/
-
- // Handle
-
- WIconHandle GetHandle() const;
-
- // Valid
- //
- // TRUE if icon was created/loaded.
-
- WBool GetValid() const;
-
- /************************************************************
- * Methods
- ************************************************************/
-
- // Clear
- //
- // Set the icon to a null state. Deletes the icon
- // handle unless it's a stock icon or nodelete was specified.
-
- void Clear();
-
- // Create
- //
- // Create a new icon. First clears old icon by calling
- // the Clear method.
-
- WBool Create( WStockIcon stock );
- WBool Create( const WResourceID & id, WModuleHandle module=_ApplicationModule );
- WBool Create( const WChar * file, const WResourceID & id );
- WBool Create( const WChar * file, WBool monochrome=FALSE,
- const WSize & iconSize = WSize(0,0) );
- WBool Create( WIconHandle handle, WBool deleteHandle=FALSE );
- WBool Create( const WIcon & icon );
- WBool Create( const WBitmap & bitmap, WPoint hotPoint,
- WBool color=TRUE, WBool useSystemIconSize=TRUE );
-
- // Save
-
- WBool Save( const WFilePath & path, WUInt bitsPerPixel=0 ) const;
-
- /***********************************************************
- * Static Methods
- ***********************************************************/
-
- // IsValidHandle
- //
- // Returns TRUE if the given handle is valid. Can
- // optionally specify whether or not a null handle
- // is "valid".
-
- static WBool IsValidHandle( WIconHandle handle,
- WBool nullValid=FALSE );
-
- static WBool Save( const WIconArray & icons, const WFilePath & path,
- WUInt bitsPerPixel=0 );
-
- /***********************************************************
- * Static Properties
- ***********************************************************/
-
- // IconCount
-
- static WUInt GetIconCount( const WChar *file );
-
- // NullIcon
-
- static const WIcon & GetNullIcon();
-
- /***********************************************************
- * Operators
- ***********************************************************/
-
- WIcon & operator=( const WIcon & icon );
-
- /***********************************************************
- * Data Members
- ***********************************************************/
-
- private:
- WIconReference * _iconRef;
- };
-
- #ifdef _DEBUG
- #define W_ISICONHANDLE(h) CHECKGDI( WIcon::IsValidHandle( (WIconHandle) h ) )
- #else
- #define W_ISICONHANDLE(h)
- #endif
-
- #ifndef _WNO_PRAGMA_PUSH
- #pragma enum pop;
- #pragma pack(pop);
- #endif
-
- #endif // _WICON_HPP_INCLUDED
-